using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace Liya.Crm.Data.Models.Mapping
{
    public class Sys_FunctionMap : EntityTypeConfiguration<Sys_Function>
    {
        public Sys_FunctionMap()
        {
            // Primary Key
            this.HasKey(t => t.FId);

            // Properties
            this.Property(t => t.FName)
                .HasMaxLength(50);

            this.Property(t => t.FSign)
                .HasMaxLength(100);

            this.Property(t => t.FUrl)
                .HasMaxLength(50);

            this.Property(t => t.FIco)
                .HasMaxLength(50);

            this.Property(t => t.FMemo)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("Sys_Function");
            this.Property(t => t.FId).HasColumnName("FId");
            this.Property(t => t.FName).HasColumnName("FName");
            this.Property(t => t.FSign).HasColumnName("FSign");
            this.Property(t => t.FType).HasColumnName("FType");
            this.Property(t => t.FModuleId).HasColumnName("FModuleId");
            this.Property(t => t.FUrl).HasColumnName("FUrl");
            this.Property(t => t.FParentId).HasColumnName("FParentId");
            this.Property(t => t.FIco).HasColumnName("FIco");
            this.Property(t => t.FSortNo).HasColumnName("FSortNo");
            this.Property(t => t.FFlag).HasColumnName("FFlag");
            this.Property(t => t.FMemo).HasColumnName("FMemo");

            // Relationships
            this.HasOptional(t => t.Sys_Module)
                .WithMany(t => t.Sys_Function)
                .HasForeignKey(d => d.FModuleId);

        }
    }
}
